package com.zhj.cloud.eureka.client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;

import javax.annotation.Resource;
import javax.ws.rs.GET;

/**
 * eureka 客户端
 */
@SpringBootApplication
@EnableEurekaClient
@RestController
@RequestMapping("/value")
public class EurekaClientApplication {

    @Resource
    private RestTemplate restTemplate;

    @GetMapping
    public String get() {
        return restTemplate.getForObject("http://eureka-provider-1/value", String.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(EurekaClientApplication.class);
    }
}
